<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>JS Enrichment Kit 0.1.0 Functional Test</title>
        
        <script src="../ek.js" type="text/javascript" charset="utf-8"></script>
        <script src="../ek.location.js" type="text/javascript" charset="utf-8"></script>
        <script src="../ek.rewriter.js" type="text/javascript" charset="utf-8"></script>		
        <script src="../ek.dispatcher.js" type="text/javascript" charset="utf-8"></script>

        <script src="ek.test.functional.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body onload="load();">
        <a id="link1" href="#/test1">test1</a>
        <a href="#/test1/test2">test2</a>
        <a href="#/test1/test2/test3">test3</a>
        <a href="#/test1/test2/test3/test4">test4</a>
        
        <a href="#/TestConstructor/show/hello/world">function</a>
        <a href="#/testObject/show/hello/world">object</a>

        <script type="text/javascript" charset="utf-8">
            function load() {
                var rewriter = new EK.Rewriter();
                var dispatcher = new EK.Dispatcher();
                dispatcher.routes.test = {
                    pattern: /^[^#]*#\/([^\/]*)\/([^\/]*)\/([^\/]*)\/([^\/]*)/,
                    controller: "EK.test.$1",
                    action: "$2",
                    params: "$3, $4"
                };
                EK.location.change(function (url) {
                    EK.location.replace(url = rewriter.x(url));
                    document.title = "EK :: " + url.replace(/[^#]*#?/, "");
                    dispatcher.x(url);
                });
            }
        </script>
    </body>
</html>